Skip to content

Allow configuring the local host for port forwarrding sessions - #2

Open
daniel-cohen wants to merge 1 commit into
masterfrom
fix/config-port-fwd-host
Open

Allow configuring the local host for port forwarrding sessions#2
daniel-cohen wants to merge 1 commit into
masterfrom
fix/config-port-fwd-host

Conversation

@daniel-cohen

Copy link
Copy Markdown
Owner

The port forwarding host is hardcoded to be localhost. This prevents us from connecting to it directly from docker using host.docker.internal. Allow configuring the local host name using SSM_PLUGIN_LOCAL_HOST.

Example:

export SSM_PLUGIN_LOCAL_HOST="0.0.0.0"
aws ssm start-session \
  --region ap-southeast-2 \
  --target [BASTION_EC2_INSTANCE_ID] \
  --document-name AWS-StartPortForwardingSessionToRemoteHost \
  --parameters host="[RDS_PG_ENDPOINT]",portNumber="5432",localPortNumber="2222"

Test:

docker run -it --rm  \
  --add-host "host.docker.internal:host-gateway" \
  -e "PGPASSWORD" \
  postgres:16.3 psql -h host.docker.internal -p 2222 -U [DB_USER] -d [DB_NAME]

aws#14 (comment)

The port forwarding host is hardcoded to be localhost. This prevents us from connecting to it directly from docker using host.docker.internal.
Allow configuring the local host name using  `SSM_PLUGIN_LOCAL_HOST`.

Example:
```sh
export SSM_PLUGIN_LOCAL_HOST="0.0.0.0"
aws ssm start-session \
  --region ap-southeast-2 \
  --target [BASTION_EC2_INSTANCE_ID] \
  --document-name AWS-StartPortForwardingSessionToRemoteHost \
  --parameters host="[RDS_PG_ENDPOINT]",portNumber="5432",localPortNumber="2222"
```

Test:
```sh
docker run -it --rm  \
  --add-host "host.docker.internal:host-gateway" \
  -e "PGPASSWORD" \
  postgres:16.3 psql -h host.docker.internal -p 2222 -U [DB_USER] -d [DB_NAME]

```
aws#14 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant